package main

import (
	"log"
	"os"
)

func main() {
	f, err := os.OpenFile("/tmp/first.log",
		os.O_CREATE|
			os.O_WRONLY|
			os.O_APPEND,
		os.ModePerm,
	)
	if err != nil {
		panic(err)
	}

	defer f.Close()
	log.Println("abc")
	// l1 := log.New(os.Stdout, "**", log.Ldate|log.Ltime)
	l1 := log.New(f, "**", log.Ldate|log.Ltime)
	l1.Printf("这是我定义的l1 %v\n", 1111111111)

	l2 := log.New(os.Stderr, "Error:", log.LstdFlags|log.Lmsgprefix)
	l2.Printf("这是我定义的l2 %v\n", 2222222)

}
